home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 11
/
FM Towns Free Software Collection 11.iso
/
t_os
/
tool
/
genji
/
src
/
command.c
next >
Wrap
Text File
|
1995-02-09
|
4KB
|
255 lines
#include "genji.h"
void setAsciiMode()
{
if( mode != 'A' )
{
mode = 'A';
bufp += addstrings( scsank, bufp );
}
return;
}
void setKanjiMode()
{
if( mode != 'K' )
{
mode = 'K';
bufp += addstrings( scsjis, bufp );
}
return;
}
int flushBuffer()
{
int e;
while( e = printStrings( (bufp-outbuf), outbuf ) )
{
if( printReady( e ) )
return ERR;
}
bufp = outbuf;
return NOERR;
}
void printPage( int page )
{
int s[3],i,j;
j = 0;
bufp += addstrings( pagep, bufp );
setAsciiMode();
*bufp++ = '-';
*bufp++ = ' ';
num2str( s, page, 3 );
for( i=0; i<3; i++ )
{
if( s[i] )
j = 1;
if( j )
*bufp++ = (char)(s[i]) + '0';
}
*bufp++ = ' ';
*bufp++ = '-';
*bufp++ = 0x0a;
*bufp++ = 0;
return;
}
void setKanjiSize( int c )
{
int s1[4],s2[4];
const static int kbai[3] = { 50, 100, 200 };
num2str( s1, kbai[(c&0x0f) ], 3 );
num2str( s2, kbai[(c&0xf0)>>4], 3 );
ksize[2] = s1[0] + 0x20;
ksize[3] = s1[1] + 0x20;
ksize[4] = s1[2] + 0x60;
ksize[5] = s2[0] + 0x20;
ksize[6] = s2[1] + 0x20;
ksize[7] = s2[2] + 0x70;
ksize[8] = 0;
bufp += addstrings( ksize, bufp );
pitchmask = kbai[c&0xf0>>4] / 50;
info[np][1] = c;
return;
}
void setLeftmargin( int lm )
{
int s[2];
if( lm<0 || lm>80 )
lm = 0;
num2str( s, lm, 2 );
lmrg[5] = s[0] + 0x30;
lmrg[6] = s[1] + 0x30;
bufp += addstrings( lmrg, bufp );
return;
}
void lineInit()
{
usrjis = 0x2a21;
x_pos = leftmargin*27;
lineflg = OFF;
control = OFF;
return;
}
void lineTerm()
{
y_pos += cr_p;
net_sp = leftmargin*27;
net_length = 0;
return;
}
void setFontType( int type )
{
if( type<0 || type>4 )
type = 0;
info[np][0] = type;
switch( type )
{
case 0:
bufp += addstrings( mintyo, bufp );
break;
case 1:
bufp += addstrings( gothic, bufp );
break;
}
return;
}
void setPrintDirection( int dir )
{
if( dir == 1 )
bufp += addstrings( vws, bufp );
else
bufp += addstrings( hws, bufp );
return;
}
void setNetStart()
{
net_flg = ON;
net_sp = x_pos;
return;
}
void setNetEnd()
{
net_length = x_pos - net_sp;
net_flg = OFF;
return;
}
void printNet()
{
int ss[4],sl[4],i,j;
num2str( ss, net_sp, 4 );
num2str( sl, net_length, 4 );
for( i=0; i<4; i++ )
{
netst[2+i] = (char)(ss[i]) + 0x30;
netst[9+i] = (char)(sl[i]) + 0x30;
}
bufp += addstrings( netst, bufp );
if( net_length > 0 )
for( j=0; j<net_length; j++ )
for( i=0; i<6; i++ )
*bufp++ = netdata[net_sort][(j&7)*6+i];
return;
}
void setHorizonPos( int x )
{
int s[4];
if( x<0 )
x = 0;
num2str( s, x, 4 );
mov_h[2] = s[0] + 0x30;
mov_h[3] = s[1] + 0x30;
mov_h[4] = s[2] + 0x30;
mov_h[5] = s[3] + 0x30;
bufp += addstrings( mov_h, bufp );
return;
}
void setBaseLine( int p )
{
if( p<0 || p>2 )
p = 0;
sbase[2] = p + 0x30;
bufp += addstrings( sbase, bufp );
return;
}
void setLineConnect( int p )
{
if( p == ON )
bufp += addstrings( linon, bufp );
else
bufp += addstrings( linoff, bufp );
return;
}
void setUnderline( int p )
{
if( p == ON )
bufp += addstrings( kuon, bufp );
else
bufp += addstrings( kuoff, bufp );
return;
}
void setKanjiPitch( int p )
{
int s[4];
if( p<48 || p>120 )
p = 54;
num2str( s, p, 3 );
knjp[2] = s[0] + 0x20;
knjp[3] = s[1] + 0x20;
knjp[4] = s[2] + 0x70;
bufp += addstrings( knjp, bufp );
return;
}
void setReturnPitch( int p )
{
int s[4];
if( p<1 || p>120 )
p = 60;
num2str( s, p, 3 );
retp[2] = s[0] + 0x20;
retp[3] = s[1] + 0x20;
retp[4] = s[2] + 0x70;
bufp += addstrings( retp, bufp );
return;
}
void setColorReverse()
{
if( colrev_flg == ON )
colrev_flg = OFF;
else
colrev_flg = ON;
}